if (!isServer) exitWith {};
private ["_x","_deads","_unit","_time"];
_deads = [];
while {true} do {
	{
		if (!alive _x && !isnull _x) then {
			_unit = _x;
			if ((_deads find _unit) < 0) then {
				if (isnil {_unit getVariable "TMF_MISSION_OBJECT"}) then {
					_deads set [count _deads, _unit];
					if (d_clean_bodies_weapons > 0) then {
						removeallweapons _unit;
						removeallItems _unit;
						removeBackpack _unit;
						{
							_unit removeMagazine _x;
						} foreach magazines _unit;
					};
					_unit setVariable ["dead_clean", (time + d_clean_bodies_time)];
				};
			} else {
				if (d_clean_bodies_time > 0) then {
					_time = _unit getVariable "dead_clean";
					if (_time < time) then { deleteVehicle _unit; };
				};
			};
		};
		sleep 0.01234;
	} foreach allDead;
	{
		if (count (units _x) <= 0) then {
			deleteGroup _x;
		};
	} forEach allGroups;
	_deads = _deads - [objNull];
	sleep (10 + (random 5));
};